#ifndef MISSIONLIST_H
#define MISSIONLIST_H

#include <QObject>
#include <QList>
#include <QString>
#include <QDir>

struct Mission {
  Mission(const QString *full_line)
  {
    auto quote_remover = [ = ](QString s)->QString {
      return s.replace("\"", "");
    };

    auto quote_remover_list = [ = ](QStringList s)->QStringList {
      QStringList result;
      foreach (QString a, s)
      {
        result << quote_remover(a);
      }
      return result;
    };

    QStringList s = full_line->simplified().split(" ");
    QString _f = s.takeFirst();
    ffmpeg = QDir::fromNativeSeparators(quote_remover(_f));

    s = quote_remover_list(s);
    target = s.last();
    source = s[1];
    fullArgs = s;
    status = WAITING;
  }
  QString source;
  QString target;
  QString ffmpeg;
  QStringList fullArgs;
  enum Status {WAITING, WORKING, DONE, ERROR, CANCELED} status;
};

class MissionList : public QList<Mission>
{
public:
  explicit MissionList(const QStringList *script);
  int howManyWaiting() const;
  Mission* nextWaiting();

};

#endif // MISSIONLIST_H
